Perfect Writer:1.00:CDP OEM/Lesson/LESSON5.MSS
Text file with Lesson 5 of Perfect Writer tutorial. File content Lesson 5 SEARCHING When revising a document you will frequently need to find and change specific words and phrases. It would be a tedious thing to scroll from screen to screen searching for the items that you want to change. In this lesson we will examine several very efficient command routines which Perfect Writer provides for searching a document and changing characters or words. At this time move the cursor to the center of the screen and type the CREATE TWO WINDOWS Command: Control---X 2 With the cursor in the top window call up the practice document `b:wonder', using the FIND DOCUMENT Command (Control--X Control--F). The first two search commands we will examine are: FORWARD SEARCH Control----S REVERSE SEARCH Control----R The first command searches forward from the position of the cursor to the first occurrence of the character, word, or words that you specify, while the second command searches 'backward' from the position of the cursor. Let's try a 'forward' search: With the cursor at the very beginning of the practice document, type the FORWARD SEARCH Command: Control---S Perfect Writer responds: "Forward Search :" Type the name `John', followed by the Escape Key to begin the search. Perfect Writer searches forward for the first occurrence of the name 'John', positioning the cursor after `John_ N. Williams'. (Note: the FORWARD SEARCH Command places the cursor after the item, while the REVERSE SEARCH Command places the cursor before the item.) Is there another 'John' in the document? To find out, type the FORWARD SEARCH Command again. (You don't need to specify the name again. Perfect Writer will continue to search for the last named item. Simply type the command (Control--S), followed by the Escape Key. Perfect Writer will advance the cursor to the name `John Smathers'. Are there any more `Johns' in this document? Type the command again, followed by the 'Escape' Key to begin the search. This time Perfect Writer leaves the cursor at its present position, displaying the message: "Not Found". It is important to understand that Perfect Writer searches not for words, but for 'strings' of characters. If it cannot find the exact character string that you have specified, it will report `Not Found'. Perfect Writer will search for an item differently, depending upon whether you specify your item using UPPER or lowercase letters. Uppercase letters will find and match ONLY uppercase letters, while lowercase letters will find and match BOTH upper and lowercase letters. That is: 'coffee' will find and match 'coffee', 'COFFEE', and 'Coffee'. 'COFFEE' will find and match only 'COFFEE'. Now try a `reverse' search, which works exactly like the `forward' search except that Perfect Writer searches backward from the position of the cursor. Move the cursor to the very end of the document, using the `End' Key. Type the REVERSE SEARCH Command 'Control---R' asking to see the first occurrence of 'Remington'. Type `Escape' to start the search process. How many times does `Remington' occur in the document? Although the FORWARD and REVERSE Search commands represent a very easy and efficient means of finding an item in even the longest documents, it does not provide a means of changing the item once it is located. Perfect Writer provides two other commands which will automatically replace one word with another throughout your document. These are: SEARCH AND REPLACE Escape. . .R SEARCH AND REPLACE (with Querry) Escape. . .Control---R The first command will replace a word or words occurring throughout your document, with another word or words. The second command does the same thing, except that for each replacement it pauses to `query' (ask) whether you really want the change to be made. Now replace every occurrence of the word 'typewriter' with the two words 'writing machine'. Move the cursor to the beginning of the practice document and type the SEARCH AND REPLACE Command: Escape. . .R Perfect Writer responds with the message: "Replace :". Enter the word `typewriter', followed by the Escape Key. Perfect Writer then asks: "With :". Enter `writing machine', followed by the Escape Key to begin the operation. The process takes a few moments. When finished, Perfect Writer redisplays the document showing the new changes that you requested. Have they all been made? Using the FORWARD or REVERSE SEARCH Commands, search through the document for every occurrence of the words 'writing machine?' Was the change appropriate in every instance? Notice that even though you did not specify it, 'plural' forms of the word 'typewriter' were also replaced. Suppose now that you do not want to change EVERY occurrence of a word or words. Perfect Writer provides the SEARCH and REPLACE (with Querry) Command, which allows you to decide upon every change that is made. The command works almost identically to the Search and Replace command, with a few extras thrown in. Review all the steps before attempting an exercise, since once you begin the Search and Replace process, you will be unable to scroll this lesson for further instructions. When you give the Search and Replace (With Querry) Command, Perfect Writer asks for the word to be replaced: "Query Replace : " As before, enter the word you want to replace, followed by the Escape Key. Perfect Writer then asks for the replacement: "With : " Enter the replacement followed by the Escape Key to begin the operation. Perfect Writer searches forward to the first occurrence of the word and presents you with the message: "Replacing `old word' with `new word'. At this point you can respond in one of several ways (You may want to make a note of these): 1) Type 'Y'--Perfect Writer will replace the words and continue to the next word. 2) Type 'N'--Perfect Writer will not replace the words, but will continue to the next word. 3) Type a comma ( , )--Perfect Writer will change the words, but will ask whether you like the change: "Confirm replace?" A 'Y' means 'Yes, I like the change'. An 'N' means 'No, put it back the way it was before'. Perfect Writer then continues to the next word. 4) Type an exclamation point ( ! )--Perfect Writer immediately makes all remaining changes without bothering to ask you about them. 5) Type a period ( . )--Perfect Writer cancels the Search and Replace Operation and returns you to the point in the text where the original command was given. 6) Type the CANCEL Command (Control--G)--Perfect Writer cancels the Search and Replace Operation, leaving the cursor at its present location in the text. Have you got that? Let's try a 'Search and Replace (With Querry)', this time changing all instances of 'writing machine' back to 'typewriter'. (If you get stuck anywhere, just cancel the operation and start over.) With the cursor at the beginning of the document, give the command: Escape. . .Control---R (A few seconds pass) Well, how did it go? We're sure that as you begin using Perfect Writer more and more, you will find these command routines for searching and replacing very valuable. This concludes our lesson on 'Searching'. At this time switch the cursor to the bottom window using the OTHER WINDOW Command: Control---X o (the letter 'o') End the split-screen using the ONE WINDOW Command: Control---X 1 The window holding these instruction will become the only window on the screen. SUMMARY In this lesson you have learned command routines that allow items to be quickly searched and, if necessary, automatically replaced. The commands are: FORWARD SEARCH Control----S REVERSE SEARCH Control----R SEARCH AND REPLACE Escape. . .R SEARCH AND REPLACE (with Querry) Escape. . .Control---R If you want to continue on to Lesson 6 which discusses `Multiple Buffers' and `File Commands', type the READ DOCUMENT Command: Control---X Control---R [ IMPORTANT: Perfect Writer will respond with the message: "Discard modifications you have made?" Answer: `y' for `Yes' ! ] Perfect Writer will then display the message "File to read: ". Type the file name "b:lesson6", followed by a carriage return. Perfect Writer will retrieves Lesson 6 from disk and displays it to the screen, ready for you to continue. If you do not want to continue with the lessons, type the QUIT Command: Control--X Control---C [ IMPORTANT: Perfect Writer will respond with the message: "Ignore Changes This Session?". Answer: 'Yes' !! ] Perfect Writer returns you to its Main Menu, from which you may exit to your operating system. END OF LESSON 5�